<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// 冒泡排序
			var arr = [60, 2, 4, 70, 45, 90, 6];


			// j <array.length 外层循环需要循环7次  每一次执行外层循环都是找到最大值防抖最后面
			//
			for (var j = 0; j < arr.length - 1; j++) {

				for (var i = 0; i < arr.length - j - 1; i++) {

					if (arr[i] > arr[i + 1]) {

						var temp = arr[i];

						arr[i] = arr[i + 1];

						arr[i + 1] = temp;

					}

				}


			}
		</script>
	</body>
</html>
